package stu.day19_day24.day21;

public class LeetCode367 {
    public boolean isPerfectSquare(int num) {

    int left = 1;
    int right = num+1;

    while (left<right) {
        int mid = (left + right) / 2;

        long sque = (long) mid*mid;

        if(sque==num){
            return true;
        } else if (sque>num) {
            right = mid;

        }else {
            left = mid+1;
        }
    }

    return false;

    }
}
